package dao.impl;

import dao.WorkOrderDao;
import entry.WorkOrder;
import util.DBHelper;

import java.util.ArrayList;

public class WorkOrderDaoImpl implements WorkOrderDao {


    private DBHelper db=new DBHelper();


    @Override
    public ArrayList<WorkOrder> queryByPid(WorkOrder workOrder) {
        String sql="select * from workorder where PID=? ";
        return db.query(sql,WorkOrder.class,workOrder.getPID());
    }

    @Override
    public int insert(WorkOrder workOrder) {
        String sql="insert into workorder values(null,?,?,?,?,current_date())";
        return db.updateTable(sql,workOrder.getPID(),workOrder.getEXECUTOR(),workOrder.getDESCRIPTION(),workOrder.getORDERLEVEL());
    }
}
